package com.example.mail;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.R;

public class MailBodyActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mailbodylayout);

        Bundle bundle = getIntent().getExtras();
        String selectedTurn = bundle.getString("turn");
        String selectedFrom = bundle.getString("from");
        String selectedBody = bundle.getString("body");

        LinearLayout mailBodyLayout = (LinearLayout) findViewById(R.id.mailBody);
        LayoutInflater linflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);

        View bodyView = linflater.inflate(R.layout.mailbody, null);
        TextView turn = (TextView) bodyView.findViewById(R.id.turn);
        turn.setText("Turn: " + selectedTurn);

        TextView from = (TextView) bodyView.findViewById(R.id.from);
        from.setText("From: " + selectedFrom);

        TextView body = (TextView) bodyView.findViewById(R.id.body);
        body.setText(selectedBody);

        mailBodyLayout.addView(bodyView);
    }
}
